home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
NEW_TECH
/
NTUNZ2.ZIP
/
UNZIP.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-02-10
|
61KB
|
1,773 lines
/*---------------------------------------------------------------------------
unzip.h
This header file is used by all of the UnZip source files. Its contents
are divided into seven more-or-less separate sections: predefined macros,
OS-dependent includes, (mostly) OS-independent defines, typedefs, function
prototypes (or "forward declarations," in the case of non-ANSI compilers),
macros, and global-variable declarations.
---------------------------------------------------------------------------*/
#ifndef __unzip_h /* prevent multiple inclusions */
#define __unzip_h
/*****************************************/
/* Predefined, Machine-specific Macros */
/*****************************************/
#if defined(__GO32__) && defined(unix) /* MS-DOS extender: NOT Unix */
# undef unix
#endif
#if defined(unix) || defined(M_XENIX) || defined(COHERENT) || defined(__hpux)
# ifndef UNIX
# define UNIX
# endif
#endif /* unix || M_XENIX || COHERENT || __hpux */
#if defined(__convexc__) || defined(MINIX)
# ifndef UNIX
# define UNIX
# endif
#endif /* __convexc__ || MINIX */
#ifdef __COMPILER_KCC__
# include <c-env.h>
# ifdef SYS_T20
# define TOPS20
# endif
#endif /* __COMPILER_KCC__ */
/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
#ifdef __POWERC
# define __TURBOC__
# define MSDOS
#endif /* __POWERC */
#if defined(__MSDOS__) && (!defined(MSDOS)) /* just to make sure */
# define MSDOS
#endif
#if defined(linux) && (!defined(LINUX))
# define LINUX
#endif
/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C, or
* Silicon Graphics, or Convex?, or IBM C Set/2, or GNU gcc/emx, or Watcom C,
* or Macintosh, or Windows NT, or Sequent, or Atari.
*/
#if defined(__STDC__) || defined(MSDOS) || defined(sgi)
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__)
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if defined(THINK_C) || defined(MPW) || defined(WIN32) || defined(_SEQUENT_)
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
#if defined(ATARI_ST) || defined(__BORLANDC__) /* || defined(__convexc__) */
# ifndef PROTO
# define PROTO
# endif
# define MODERN
#endif
/* turn off prototypes if requested */
#if defined(NOPROTO) && defined(PROTO)
# undef PROTO
#endif
/* used to remove arguments in function prototypes for non-ANSI C */
#ifdef PROTO
# define OF(a) a
#else /* !PROTO */
# define OF(a) ()
#endif /* ?PROTO */
/* bad or (occasionally?) missing stddef.h: */
#if defined(M_XENIX) || defined(DNIX)
# define NO_STDDEF_H
#endif
#if (defined(__NetBSD__) && !defined(__386BSD__))
# define __386BSD__
#endif
#if 0 /* GRR 931003: BOGUS! Screwed-up systems can define this explicitly */
/* cannot depend on MODERN for presence of stdlib.h */
#if defined(__GNUC__)
# if (!defined(__EMX__) && !defined(__386BSD__) && !defined(LINUX))
# define NO_STDLIB_H
# endif
#endif /* __GNUC__ */
#endif /* 0 */
#if defined(apollo) /* defines __STDC__ */
# define NO_STDLIB_H
#endif /* apollo */
#ifdef DNIX
# define SYSV
# define SHORT_NAMES /* 14-char limitation on path components */
/* # define FILENAME_MAX 14 */
# define FILENAME_MAX NAME_MAX /* GRR: experiment */
#endif
#if (defined(__SYSTEM_FIVE) || defined(M_SYSV) || defined(M_SYS5))
# ifndef SYSV
# define SYSV
# endif /* !SYSV */
#endif /* __SYSTEM_FIVE || M_SYSV || M_SYS5 */
#if (defined(SYSV) || defined(CRAY) || defined(LINUX))
# ifndef TERMIO
# define TERMIO
# endif /* !TERMIO */
#endif /* SYSV || CRAY || LINUX */
#if (defined(ultrix) || defined(bsd4_2) || defined(sun) || defined(pyr))
# if (!defined(BSD) && !defined(SYSV))
# define BSD
# endif
#endif /* ultrix || bsd4_2 || sun || pyr */
#if defined(__convexc__) || defined(__386BSD__)
# if (!defined(BSD) && !defined(SYSV))
# define BSD
# endif
#endif /* __convexc__ || __386BSD__ */
#ifdef pyr /* Pyramid */
# ifdef BSD
# define pyr_bsd
# endif
# define ZMEM /* should ZMEM only be for BSD universe...? */
# define DECLARE_ERRNO /* (AT&T memcpy was claimed to be very slow) */
#endif /* pyr */
#if (defined(CRAY) && defined(ZMEM))
# undef ZMEM
#endif
/* stat() bug for Borland, Watcom, VAX C (also GNU?), and Atari ST MiNT on
* TOS filesystems: returns 0 for wildcards! (returns 0xffffffff on Minix
* filesystem or U: drive under Atari MiNT) */
#if (defined(__TURBOC__) || defined(__WATCOMC__) || defined(VMS))
# define WILD_STAT_BUG
#endif
#if (defined(__MINT__))
# define WILD_STAT_BUG
#endif
#ifdef WILD_STAT_BUG
# define SSTAT(path,pbuf) (iswild(path) || stat(path,pbuf))
#else
# define SSTAT stat
#endif
#define STRNICMP zstrnicmp
#if 0 /* internal version renamed to zstrnicmp and used for all systems now */
/* SCO Unix, dnix, Interactive SysV (all SysV?): no strnicmp or strncasecmp.
* Also Sun 386i, VMS (just VAX C?), djgpp 1.10 and earlier, Coherent. */
#if (defined(SYSV) || defined(sun386) || defined(VMS) || defined(__GO32__))
# define NO_STRNICMP
#endif
#if (defined(COHERENT))
# define NO_STRNICMP
#endif
#ifndef NO_STRNICMP
# if (!defined(MODERN) || defined(NeXT) || defined(CRAY) || defined(LINUX))
# define strnicmp strncasecmp
# endif
# if (defined(__386BSD__) || defined(__bsdi__))
# define strnicmp strncasecmp
# endif
#endif
#endif /* 0 */
/***************************/
/* OS-Dependent Includes */
/***************************/
#ifndef MINIX /* Minix needs it after all the other includes (?) */
# include <stdio.h>
#endif
#include <ctype.h> /* skip for VMS, to use tolower() function? */
#include <errno.h> /* used in mapname() */
#include <string.h> /* GRR: EXPERIMENTAL! */
#ifdef MODERN
# include <limits.h> /* GRR: EXPERIMENTAL! (can be deleted) */
#endif
#if 0 /* GRR: MORE EXPERIMENTING (moved to OS sections) */
#ifdef VMS
# include <types.h> /* (placed up here instead of in VMS section below */
# include <stat.h> /* because types.h is used in some other headers) */
#else /* !VMS */
# if (!defined(THINK_C) && !defined(MPW) && !defined(ATARI_ST) && !defined(AZTEC_C))
# include <sys/types.h> /* off_t, time_t, dev_t, ... */
# include <sys/stat.h>
# endif /* !THINK_C && !MPW && !ATARI_ST && !AZTEC_C */
#endif /* ?VMS */
#endif
#ifdef EFT
# define LONGINT off_t /* Amdahl UTS nonsense ("extended file types") */
#else
# define LONGINT long
#endif
#ifdef MODERN
# ifndef NO_STDDEF_H
# include <stddef.h>
# endif
# ifndef NO_STDLIB_H
# include <stdlib.h> /* standard library prototypes, malloc(), etc. */
# endif
typedef size_t extent;
typedef void voidp;
/* # include <string.h> */ /* defines strcpy, strcmp, memcpy, etc. */
#else /* !MODERN */
/* char *strchr(), *strrchr(); */
LONGINT lseek();
char *malloc();
typedef unsigned int extent;
typedef char voidp;
# define void int
#endif /* ?MODERN */
/* this include must be down here for SysV.4, for some reason... */
#include <signal.h> /* used in unzip.c, file_io.c */
/*---------------------------------------------------------------------------
Amiga section:
---------------------------------------------------------------------------*/
#ifdef AMIGA
# include "amiga/amiga.h"
# ifndef AZTEC_C
# include <sys/types.h> /* off_t, time_t, dev_t, ... */
# include <sys/stat.h>
# endif
# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
# define DATE_FORMAT DF_MDY
# define lenEOL 1
# define PutNativeEOL *q++ = native(LF);
/* # define USE_FWRITE if write() returns 16-bit int */
#endif
/*---------------------------------------------------------------------------
Atari ST section:
-----------------------------------------------------------